package com.fl.message.controller;

import com.fl.message.entity.UserMessage;
import com.fl.message.mq.RabbitmqSend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 联系客服
 *
 * @Author: fulin
 * @Date: 2023/01/06/13:16
 * @Description:
 */
@RequestMapping("/opinion")
@Controller
public class OpinionController {

    @Autowired
    private RabbitmqSend rabbitmqSend;

    @PostMapping("/push")
    @ResponseBody
    public String pushMessage(UserMessage userMessage) {
        rabbitmqSend.sendMessage(userMessage);
        return "ok";
    }

    @GetMapping("/customer")
    public String welcomeCustomer() {
        return "customer/index";
    }

    @GetMapping("/server")
    public String welcomeServer() {
        return "server/index";
    }

}
